//
//  LzwTwodetailCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/7.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwTwodetailCell.h"
#import "LzwBaseLable.h"
#import "LzwBaseImageView.h"
#import "UIImageView+WebCache.h"

@interface LzwTwodetailCell ()

@property (nonatomic, retain) LzwBaseImageView *myTwoImage1;
@property (nonatomic, retain) LzwBaseImageView *myTwoImage2;

@property (nonatomic, retain) LzwBaseLable *myTwoLable1;
@property (nonatomic, retain) LzwBaseLable *myTwoLable2;

@end

@implementation LzwTwodetailCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatTwoSubView];
    }
    
    return self;
}

- (void)creatTwoSubView{
    
    //图片
    self.myTwoImage1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(2 * WIDTH, 2 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myTwoImage1.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myTwoImage1];
    
    //喜爱图片
    self.myTwoImage2 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 * WIDTH - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myTwoImage2.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myTwoImage2];
    
    //描述
    self.myTwoLable1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myTwoLable1.textColor = [UIColor lightGrayColor];
    self.myTwoLable1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myTwoLable1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myTwoLable1];
    
    //喜爱人数
    self.myTwoLable2 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 45 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myTwoLable2.textColor = [UIColor lightGrayColor];
    self.myTwoLable2.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myTwoLable2.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myTwoLable2];
    
}

-(void)setModleTCell:(LzwTwoDeModle *)modleTCell{
    
    if (_modleTCell != modleTCell) {
        [_modleTCell release];
        _modleTCell = [modleTCell retain];
    }
    
    self.myTwoLable1.text = self.modleTCell.title;
    self.myTwoLable2.text = self.modleTCell.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleTCell.pic];
    
    [self.myTwoImage1 sd_setImageWithURL:url placeholderImage:nil];
    
}




@end
